home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / walsh.doc < prev    next >
Text File  |  1995-03-31  |  3KB  |  69 lines

  1. WALSH.DOC -- A step-by-step Voyager tutorial. 
  2. By Joseph K. Horn 
  3.  
  4. There is a binary file's Voyager-format MEM image on this disk called 
  5. WALSH.MEM.  It was created from an HP 48 library created by Brian Walsh. 
  6. The name and purpose of his library is NOT DOCUMENTED here, because: 
  7.  
  8. This file is included specifically to show you how easy it is to tear apart 
  9. an HP 48 library, completely figure out what it's for and how it was written, 
  10. and even surgically remove routines from a library (manually! without TOOLS!), 
  11. without having a scrap of documentation for the library itself.  And then 
  12. write an improved version that's shorter and faster! 
  13.  
  14. (I assume below that DNICKEL is your current directory, and that you're 
  15. working from the floppy.  If you copied the floppy to hard disk, use the 
  16. appropriate pathname below...) 
  17.  
  18. Just run Voyager, LOAD 1 \HORN2\WALSH, then UT 80000.  You'll see: 
  19.  
  20. 80000: 02B40 ! Library 
  21. 80005: 0131B ! 4891 nibbles (next RPL at 81320) 
  22. 8000A: [...] ! Library name: "Util:C  Brian Walsh" 
  23. 80034: 6A0   ! Library number 1696     <----- 
  24. 80037: 010F2 ! Hash table at 81129     <----- 
  25. 8003C: 00000 ! No message table 
  26. 80041: 0105C ! Link table at 8109D     <----- 
  27. 80046: 01024 ! Configuration code at 8106A 
  28.  
  29. Now let's use the library number (6A0), hash address (81129) and link address 
  30. (8109D) to EXAMINE HASH 8129 6A0, and you'll see (among other things): 
  31.  
  32. 811C0: [...] !   NIP (XLIB 1696 5) 
  33.  
  34. Which means that there is a function in Walsh's library called NIP; it's 
  35. XLIB 1696 5.  EXAMINE LINK 8109D 6A0 and see (among other things): 
  36.  
  37. 810C0: FFD71 !   XLIB 1696 5 at 80E31 
  38.  
  39. So NIP starts at 80E31; we can look at NIP's listing by UT 80E31: 
  40.  
  41. 80E31: 02D9D ! Program 
  42. 80E36: 2361E ; << (XLIB 1792 18) 
  43. 80E3B: 1FBBD ; SWAP (XLIB 2 271) 
  44. 80E40: 1FBD8 ; DROP (XLIB 2 272) 
  45. 80E45: 23639 ; >> (XLIB 1792 19) 
  46. 80E4A: 0312B ! End Marker 
  47.  
  48. So Brian wrote a program called NIP which is simply << SWAP DROP >>. 
  49.  
  50. If the library is in your HP 48 at the beginning of port 1, you can even 
  51. recall this program to the stack by typing #80E31h and running the SYSRCL 
  52. program (see IO.DOC on this disk). 
  53.  
  54. Brian's NIP is 15 bytes long.  Writing a 2.5-byte version, using the tools 
  55. on this disk, is simple: 
  56.  
  57. NIP's purpose is to drop the object in level two.  To see if there's a system 
  58. routine that does this, type "find : drop" in Voyager.  All the routines with 
  59. DROP in them will be listed; among them, see "60F9B drop level two object". 
  60. That's what we want!  Just type << #60F9B SYSEVAL >>, then run PACK to turn 
  61. the SYSEVAL into an External, and run STRIP to remove the program delimiters. 
  62. The result is a 2.5-byte program (looks like "External") which performs the 
  63. same function as NIP in Brian's library. 
  64.  
  65. See also the TOOLS file on this disk, which contains a program called 
  66. Extract, which automatically "extracts" a program from a library. 
  67.  
  68. -- Joe Horn 
  69.